#ifndef SUDOKUCELLSET_H
#define SUDOKUCELLSET_H

#include <QList>

class SudokuCell;

/**
  * Cells should only be added by calling append() because mType have bo be invalidated when cell is changed.
  */
class SudokuCellSet : public QList<SudokuCell*>
{

public:

    enum SetType
    {
        Unknown = 0x0,
        Col     = 0x1,
        Row     = 0x2,
        Box     = 0x4,
        Other   = 0x16
    };
    Q_DECLARE_FLAGS(SetTypes, SetType)

    SudokuCellSet(SetType type = Unknown);

    void append(SudokuCell* const& cell);

    /**
      * @return true if this contains all cells from other
      */
    bool containsSet(const SudokuCellSet& other) const;

    bool isCol();
    bool isRow();
    bool isBox();

    friend QDebug operator<<(QDebug dbg, const SudokuCellSet& set);

private:

    SetTypes mType;

    /**
      * True when mType cannot change (is set once in constructor of house)
      */
    bool mFixedType;

    void checkType();
};

Q_DECLARE_OPERATORS_FOR_FLAGS(SudokuCellSet::SetTypes)

#endif // SUDOKUCELLSET_H
